<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>外卖管理系统</title>
<link rel="stylesheet" href="/css/admin.css" type="text/css"/>
<script type="text/javascript" src="/js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="/js/popup.js"></script>
</head>
<body leftmargin="2" topmargin="2">
<s:form id="create" action="admin_restaurant_menu" onsubmit="VF_restaurantflag();return false;">
<s:hidden name="action" />
<s:hidden name="id" />
<s:hidden name="resId" id="resId" />
 <fieldset><legend>
 <s:if test="%{action=='doadd'}">添加菜单方式</s:if>
 <s:if test="%{action=='doupdate'}">修改菜单方式</s:if>
 </legend>
 <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <COLGROUP>
  <COL width="100" />
  <COL width="*" />
    <tr class="tdbg2"> 
      <td align="right" >饭店名称：</td>
      <td><s:textfield id="resName" name="resName" size="20"/><a href="javascript:getScriptorium()">查询饭店</a></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">名  称：</td>
      <td><s:textfield id="menuName" name="menuName" size="20"/></td>
    </tr>
    <tr class="tdbg2"> 
      <td align="right">备 注：</td>
      <td><s:textfield id="menuMemo" name="menuMemo" size="20"/></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">首 字 母：</td>
      <td><s:textfield id="menuInitials" name="menuInitials" size="20"/></td>
    </tr>
    <tr class="tdbg2"> 
      <td align="right">简  拼：</td>
      <td><s:textfield id="menuAnglic" name="menuAnglic" size="20"/></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">全  拼：</td>
      <td><s:textfield id="menuPhonetic" name="menuPhonetic" size="20"/></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">价  格：</td>
      <td><s:textfield id="price" name="price" size="20"/></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">折扣价：</td>
      <td><s:textfield id="discount" name="discount" size="20"/></td>
    </tr>  
    <tr class="tdbg3"> 
      <td align="right">是否促销：</td>
      <td><s:select list="isPromotionList" name="isPromotion" id="isPromotion" listKey="key" listValue="value"></s:select></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">菜单类别：</td>
      <td><s:select list="typeList" name="typeId" id="typeId" listKey="key" listValue="value"></s:select></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">是否招牌：</td>
      <td><s:select list="isFaciaList" name="isFacia" id="isFacia" listKey="key" listValue="value"></s:select></td>
    </tr>
    <tr class="tdbg3"> 
      <td align="right">是否显示：</td>
      <td><s:select list="isShowList" name="isShow" id="isShow" listKey="key" listValue="value"></s:select></td>
    </tr>
	<tr class="tdbg3"> 
      <td align="right">排  序：</td>
      <td><s:textfield id="orderNum" name="orderNum" size="20"/></td>
    </tr>
     <tr class="tdbg3">
      <td colspan="2" align="center"><s:submit value="提交"/></td>
    </tr>
</table></fieldset>
</s:form>
<script type="text/javascript">
function VF_restaurantflag(){ 
    var errMsg = "";
    if(isNaN($('#orderNum').val())){
		errMsg = "排序请添写数字！";
	}
	if ($('#isShow').val() == -1){
        errMsg = "请选择显示信息！";
    }
    if ($('#isFacia').val() == -1){
        errMsg = "请选择是否招牌！";
    }
    if ($('#typeId').val() == -1){
        errMsg = "请选择菜单类别！";
    }
    if ($('#isPromotion').val() == -1){
        errMsg = "请选择是否促销！";
    }
    if(isNaN($('#discount').val())){
		errMsg = "折扣价请添写数字！";
	}
	if(isNaN($('#price').val())){
		errMsg = "价格请添写数字！";
	}
    if ($('#menuPhonetic').val() == ""){
        errMsg = "请填写全拼！";
    }
    if ($('#menuAnglic').val() == ""){
        errMsg = "请填写简拼！";
    }
	if ($('#menuInitials').val() == ""){
        errMsg = "请填写首字母！";
    }
    if ($('#menuName').val() == ""){
        errMsg = "请填写名称！";
    }
    if ($('#resId').val() == -1){
        errMsg = "请选择饭店！";
    }
    if (errMsg != ""){
        alert(errMsg);
    }else{
		document.getElementById('create').submit();
	}
}
function getScriptorium(){ 
		openshow('/admin_restaurant.action?action=pop','饭店信息',false,700,310,1);
}
function resSelect(resName,id){
	$('#resName').val(resName);
	$('#resId').val(id);
}
</script>
</body>
</html>
